import { get_list } from "@/app/utils/http";
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
let initialState={
    list:[]
}
const todosSlice = createSlice({
  name: "todos",
  initialState,
  reducers: {
   t_get(state,action){
    state.list=action.payload
   }
  },
});

export const comfn = todosSlice.actions;
export default todosSlice.reducer;

// 获取数据
export let async_get=createAsyncThunk('async_get',async(_,store)=>{
  let res=await get_list()
  store.dispatch(res)
})